//
//  HBTaskSuccessController.m
//  HeartBeat
//
//  Created by karong on 2023/9/11.
//

#import "HBTaskSuccessController.h"
#import "HBTaskModel.h"

@interface HBTaskSuccessController ()
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;

@end

@implementation HBTaskSuccessController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.titleLabel.text = (self.model.id > 0)?@"":WSLocalized(@"签到成功");
    self.contentLabel.text = SF(WSLocalized(@"恭喜获得%ld書幣奖励"), (long)self.model.coins);
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [self animation];
    });
}

- (void)animation {
    NSMutableArray * array = [NSMutableArray new];//[@"receive_1"];
    for (int i = 0; i < 9; i++) {
        [array addObject:IMG(SF(@"receive_%d", i+1))];
    }
    [self.imageView setAnimationImages:array];
    [self.imageView setAnimationDuration:1.5];
    [self.imageView setAnimationRepeatCount:MAXFLOAT];
    [self.imageView startAnimating];
    
}
- (IBAction)closeAction:(id)sender {
    [self dismiss];
}

@end
